<?php
class Admin_Acl_AdminUser_Create_Action extends NICED_Action 
{       
	public function execute() 
	{
        $this->forward("admin.index");
		$controller = $this->getController();
		$request    = $controller->getRequest();			
        $user_id    = $request->loadParam("user_id", NULL, "safe");
        $password   = $request->loadParam("password", NULL, "safe");
        $role_ids   = $request->loadParam("role_ids", NULL);
        $act  = $request->loadParam("act", NULL, "safe");

        //if no act param, show create page
        if (!$act)
        {
            return self::SUCCESS;
        }

		$model      = $controller->getModel('Admin.Acl.AdminUser.Index');

		try
		{
            $model->create($user_id, $password, $role_ids);
		}
		catch (Exception $e)
		{
			$controller->handleException($e);
			return self::SUCCESS;
		}

		return self::SUCCESS;
	}

}//end class
